package com.rd.student.jiaji.class1.wangyufang.day0801;

import java.util.Arrays;

public class ArrayTest2 {
    public static void main(String[] args) {
        int[] array = new int[10];
        int sum = 0;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < array.length; i++) {
            array[i] = i + 1;
            sum = sum + array[i];
            if (max < array[i]) {
                max = array[i];
            }
            if (min > array[i]) {
                min = array[i];
            }
        }
        System.out.println(Arrays.toString(array));
        System.out.println("数组中所有元素的和为：" + sum);
        double average = sum / 10.0;
        System.out.println("所有元素的平均值:" + average);
        System.out.println("此数组的最大值为：" + max);
        System.out.println("此数组的最小值为：" + min);
    }
}
